//
//  LeftCell.m
//  TinyFortune
//
//  Created by lc on 16/6/6.
//  Copyright © 2016年 lc. All rights reserved.
//

#import "LeftCell.h"
#import "comModel.h"


@implementation LeftCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)layoutSubviews{
    CGFloat margin = 20.0 ;
    _leftLabel.numberOfLines = 0;
    CGRect leftLable = [self.leftLabel.text boundingRectWithSize:CGSizeMake(LC_WIDTH - 150, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]} context:nil];
   
    self.leftLabel.frame = CGRectMake(_leftLabel.frame.origin.x, _leftLabel.frame.origin.y, leftLable.size.width, leftLable.size.height);
    
 
    
    UIImage *image = [UIImage imageNamed:@"ReceiverTextNodeBkg"] ;
    image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(28, 32, 28, 32) resizingMode:UIImageResizingModeStretch];
    
    self.leftBubble.image = image;
    
    self.leftBubbleHeight.constant = leftLable.size.height + margin +5;
    self.leftBubbleWithd.constant = leftLable.size.width + margin * 2 + 5.0;
    
  
}
- (void)setMessage:(AVIMMessage *)message{
    _message = message ;
    self.messageSenderClientId = message.clientId ;
    
}
- (void)setModel:(comModel *)model{
    _model = model ;
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:_model.icon]];
    self.leftLabel.text = _model.text;
    
    NSLog(@"!!!!%@",_model.text);

}
@end
